<form method="post" enctype="multipart/form-data" target="_blank" id="form-order">
    <div class="table-responsive">
        <table class="table table-bordered table-hover">
            <thead>
                <tr>
                    <th style="width:40px;" class="text-center">                        
                    	<input type="checkbox" onclick="$('input[name*=\'selected\']').prop('checked', this.checked);">                        
                    </th>
                    <th width = "50" class="text-center">
                        <a href="javascript:sort('goods_id');">ID</a>
                    </th>
                    <th class="text-center" width = "30%">
                        <a href="javascript:sort('goods_name');">商品名称</a>
                    </th>
					<th class="text-center" style="width:80px;">
                        <a href="javascript:sort('thumb');">商品图片</a>
                    </th>
                    <th width = "8%" class="text-center">
                        <a href="javascript:sort('cat_id');">分类</a>
                    </th>
					<th width = "8%" class="text-center">
                        <a href="javascript:sort('cat_id');">语言</a>
                    </th>
					<th width = "8%" class="text-center">
                        <a href="javascript:sort('cat_id');">发布者</a>
                    </th>
                    <th class="text-center">
                        <a href="javascript:sort('shop_price');">售价</a>
                    </th>
					<th class="text-center">
                        <a href="javascript:sort('shop_price');">库存</a>
                    </th>
					<th class="text-center">
                        <a href="javascript:sort('aduit');">上架时间</a>
                    </th>
                    <th class="text-center">
                        <a href="javascript:sort('status');">状态</a>
                    </th>
                    <th width = "5%" class="text-center">
                        <a href="javascript:sort('sort');">排序</a>
                    </th>
                    <th width = "10%" class="text-center">操作</th>
                </tr>
            </thead>
            <tbody>
                <volist name="goodsList" id="list">
                    <tr>
						<td class="text-center">
                             <input type="checkbox" name="selected[]" class="sel" value="{$list.id}">
                        </td>
                        <td style="line-height:34px;" class="text-center">{$list.id}</td>
                        <td width="400" style="line-height:34px;" class="text-center">{$list.title|getSubstr=0,33}</td>
                        <td style="line-height:34px;position:relative;" data="{$i}" class="text-center thumb">
							<if condition="$list['thumb'] neq ''">
								<a href="{$list.thumb}" target="_blank">
									<img height="30" src="{$list.thumb}">
								</a>
								<img class="img" style="width:200px;position:absolute;left:80px;bottom:0;display:none;border:1px solid red;" src="{$list.thumb}">
							</if>
						</td>
						<td style="line-height:34px;" class="text-center">{$list.goods_cat}</td>
						<td style="line-height:34px;" class="text-center">
							<if condition="$list['lang'] eq 'cn'">中文<else />日文</if>
						</td>
                        <td style="line-height:34px;" class="text-center">{$list.store_name} </td>
						<td style="line-height:34px;" class="text-center">{$list.price} </td>
						<td style="line-height:34px;" class="text-center">{$list.inventory} </td>
						<td style="line-height:34px;" class="text-center">{$list.audit_time|date='Y-m-d',###} </td>
                        <td style="line-height:34px;" align="center">
                            <if condition="$list['store_id'] gt 0">
								<if condition="$list['audit'] eq 1">
									<span style="color:blue">审核通过</span>
								<elseif condition="$list['audit'] eq 2" />
									<span style="color:red">审核中</span>
								<else />
									已下架
								</if>	
							<else />
								<if condition="$list['status'] eq 1">
									<span style="color:blue">显示</span>
								<else />
									<span style="color:red">不显示</span>
								</if>	
							</if>
                        </td>
                        <td style="line-height:34px;" class="text-center">
                            <input type="text" class="form-control" onkeyup="this.value = this.value.replace(/[^\d]/g, '')" onpaste="this.value=this.value.replace(/[^\d]/g,'')" onchange="updateSort('goods', 'id', '{$list.id}', 'ordid', this)" size="4" value="{$list.ordid}" style="text-align:center;line-height:26px;" />
                        </td>
                        <td class="text-center">
                            <a href="{:U('Admin/Goods/addEditGoods',array('id'=>$list['id'],'p'=>$_GET['p']))}" class="btn btn-primary" title="编辑"><i class="fa fa-pencil"></i></a>
                            <a href="javascript:;" onclick="del('{$list[id]}')" class="btn btn-danger" title="删除"><i class="fa fa-trash-o"></i></a>
                        </td>
                    </tr>
                </volist>
            </tbody>
        </table>
    </div>
</form>
<div class="row">
    <div class="col-sm-3 text-left">
		<a onclick="delAllfun('确定审核通过吗？',1);" class="btn btn-info">审核通过</a>
		<a onclick="delAllfun('确定审核不通过吗？',2);" class="btn btn-info">审核不通过</a>
	</div>
    <div class="col-sm-9 text-right">{$page}</div>
</div>
<script>
// 点击分页触发的事件
$(".pagination a").click(function() {
    window.cur_page = $(this).data('p');
    ajaxGetTable('search-form2', cur_page);
});
function delAllfun(msg,type_id){
	var allId = '';
	$.each($('.sel:checkbox'),function(){
		if(this.checked){
			allId = allId+$(this).val()+',';
		}
	});
	if(!allId){
		layer.alert('请选择要审核的选项');
		return;
	}
	layer.confirm(msg, {
	  btn: ['确定','取消'] //按钮
	}, function(){
		$.ajax({
			type: 'post',
			url: '/Admin/Goods/all_goods',
			data: {
				id: allId,type_id:type_id
			},
			dataType: 'json',
			success: function(data) {
				if (data.code==200) {
					ajaxGetTable('search-form2', cur_page);
				} else {
					layer.alert('审核失败', {
						icon: 2
					});
				}
			}
		});	
		layer.closeAll();
	}, function(){

	});
    return false;
}
/*
 * 清除静态页面缓存
 */
function clearGoodsHtml(goods_id) {
    $.ajax({
        type: 'GET',
        url: "{:U('Admin/System/clearGoodsHtml')}",
        data: {
            goods_id: goods_id
        },
        dataType: 'json',
        success: function(data) {
            layer.alert(data.msg, {
                icon: 2
            });
        }
    });
}
/*
 * 清除商品缩列图缓存
 */
function clearGoodsThumb(goods_id) {
    $.ajax({
        type: 'GET',
        url: "{:U('Admin/System/clearGoodsThumb')}",
        data: {
            goods_id: goods_id
        },
        dataType: 'json',
        success: function(data) {
            layer.alert(data.msg, {
                icon: 2
            });
        }
    });
}
	$('.thumb').mouseenter(function(){
		var num = $(this).attr('data');
		if(num<4){
			$(this).find('.img').css('top','0');
		}
		$(this).find('.img').show();
	}).mouseleave(function(){
		$(this).find('.img').hide();
	})
</script>
